﻿<Window x:Class="GSF.PhasorProtocols.UI.Modal.ConnectionStringBuilder"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Connection String Builder" Height="300" Width="500"
        Background="Transparent" ShowInTaskbar="False" ResizeMode="NoResize">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/GSF.TimeSeries.UI.WPF;Component/Resources/CommonResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <StackPanel Orientation="Vertical" Margin="2" Background="{StaticResource MenuBackgroundBrush}">

        <CheckBox x:Name="CheckboxForceIPv4" Content="Force IPv4" HorizontalAlignment="Right"/>
        
        <TabControl x:Name="TabControlOptions">
            
            <TabItem Header="TCP" x:Name="TabItemTCP">

                <Grid>
                
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="2*" />
                        <ColumnDefinition Width="2*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Host IP" Visibility="{Binding ElementName=TextBoxHostIP, Path=Visibility}"/>
                    <TextBox x:Name="TextBoxHostIP" Grid.Row="0" Grid.Column="1" Text="127.0.0.1" Width="150"/>
                    <CheckBox x:Name="CheckboxEstablishServer" Content="Establish TCP Server" Grid.Row="0" Grid.Column="2"/>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Port" />
                    <TextBox x:Name="TextBoxPort" Grid.Row="1" Grid.Column="1" Text="4712" Width="75" />
                    <TextBlock Grid.Row="2" Grid.Column="0">Max Send <LineBreak /> Queue Size</TextBlock>
                    <TextBox x:Name="TextBoxMaxSendQueueSize" Grid.Row="2" Grid.Column="1" Text="-1" Width="75" Margin="5,5,0,5" />
                    <Button x:Name="ButtonSaveTCP" Grid.Row="3" Grid.Column="2" Content="Save" Click="ButtonSaveTCP_Click"/>
                
                </Grid>

            </TabItem>

            <TabItem Header="UDP" x:Name="TabItemUDP">

                <Grid>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="2*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Local Port"/>
                    <TextBox x:Name="TextBoxLocalPort" Grid.Row="0" Grid.Column="1" Text="4712" Width="75"/>
                    <CheckBox x:Name="CheckboxEnableMulticast" Content="Enable Multicast/Remote Udp" FontWeight="Bold" Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Margin="5" IsChecked="False" />
                    <StackPanel x:Name="StackPanelMulticastOptions" Orientation="Vertical" Grid.Row="1" Grid.Column="2" 
                                Visibility="{Binding ElementName=CheckboxEnableMulticast, Path=IsChecked, Converter={StaticResource ObjectToVisibilityConverter}}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Host IP" Width="75"/>
                            <TextBox x:Name="TextBoxHostIPUdp" Width="125"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Remote Port" Width="75"/>
                            <TextBox x:Name="TextBoxRemotePort" Width="75" />
                        </StackPanel>
                    </StackPanel>
                    <Button x:Name="ButtonSaveUDP" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Content="Save" HorizontalAlignment="Right" Click="ButtonSaveUDP_Click"/>
                </Grid>

            </TabItem>

            <TabItem Header="Serial" x:Name="TabItemSerial">

                <Grid>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="2*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="2*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Port"/>
                    <ComboBox x:Name="ComboboxPort" Grid.Row="0" Grid.Column="1" Width="125"/>
                    <TextBlock Grid.Row="0" Grid.Column="2" Text="Stop Bits"/>
                    <ComboBox x:Name="ComboboxStopBits" Grid.Row="0" Grid.Column="3" Width="125"/>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Baud Rate" />
                    <ComboBox x:Name="ComboboxBaudRate" Grid.Row="1" Grid.Column="1" Width="125"/>
                    <TextBlock Grid.Row="1" Grid.Column="2" Text="Data Bits" />
                    <TextBox x:Name="TextBoxDataBits" Grid.Row="1" Grid.Column="3" Text="8" Width="125"/>
                    <TextBlock Grid.Row="2" Grid.Column="0" Text="Parity"/>
                    <ComboBox x:Name="ComboboxParity" Grid.Row="2" Grid.Column="1" Width="125"/>
                    <CheckBox x:Name="CheckboxDTR" Content="DTR" FontWeight="Bold" Grid.Row="2" Grid.Column="2" />
                    <CheckBox x:Name="CheckboxRTS" Content="RTS" FontWeight="Bold" Grid.Row="2" Grid.Column="3"/>
                    <Button x:Name="ButtonSaveSerial" Grid.Row="3" Grid.Column="3" Content="Save" HorizontalAlignment="Right" Click="ButtonSaveSerial_Click"/>
                
                </Grid>

            </TabItem>

            <TabItem Header="File" x:Name="TabItemFile">

                <Grid>
                
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="4*" />
                    </Grid.ColumnDefinitions>
                    
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="File Name" />
                    <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1">
                        <TextBox x:Name="TextBoxFile" Width="275"/>
                        <Button x:Name="ButtonBrowseFile" Content="Browse" Click="ButtonBrowseFile_Click"/>
                    </StackPanel>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Frame Rate"/>
                    <TextBox x:Name="TextBoxFrameRate" Grid.Row="1" Grid.Column="1" Text="30" Width="75"/>
                    <CheckBox x:Name="CheckboxAutoRepeat" Content="Auto-repeat captured file playback" IsChecked="True" Grid.Row="2" Grid.Column="1"/>
                    <CheckBox x:Name="CheckboxSimulateTimeStamp" Content="Simulate Timestamp" IsChecked="True" Grid.Row="3" Grid.Column="1"/>
                    <Button x:Name="ButtonSaveFile" Grid.Row="4" Grid.Column="1" Content="Save" HorizontalAlignment="Right" Click="ButtonSaveFile_Click"/>
                
                </Grid>

            </TabItem>

            <TabItem Header="Udp Server" x:Name="TabItemUdpServer">

                <Grid>
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="4*" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="2*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" Text="Broadcast Destinations:" HorizontalAlignment="Left" FontWeight="Bold"/>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Host IP"/>
                    <TextBox x:Name="TextBoxHostIP1" Grid.Row="1" Grid.Column="1"/>
                    <TextBlock Grid.Row="1" Grid.Column="2" Text="Port"/>
                    <TextBox x:Name="TextBoxHostPort1" Text="4712" Grid.Row="1" Grid.Column="3" Width="75"/>
                    <TextBlock Grid.Row="2" Grid.Column="0" Text="Host IP"/>
                    <TextBox x:Name="TextBoxHostIP2" Grid.Row="2" Grid.Column="1"/>
                    <TextBlock Grid.Row="2" Grid.Column="2" Text="Port"/>
                    <TextBox x:Name="TextBoxHostPort2" Text="4712" Grid.Row="2" Grid.Column="3" Width="75"/>
                    <TextBlock Grid.Row="3" Grid.Column="0" Text="Host IP"/>
                    <TextBox x:Name="TextBoxHostIP3" Grid.Row="3" Grid.Column="1"/>
                    <TextBlock Grid.Row="3" Grid.Column="2" Text="Port"/>
                    <TextBox x:Name="TextBoxHostPort3" Text="4712" Grid.Row="3" Grid.Column="3" Width="75"/>
                    <Button x:Name="ButtonSaveUdpServer" Grid.Row="4" Grid.Column="3" Content="Save" HorizontalAlignment="Right" Click="ButtonSaveUdpServer_Click"/>
                
                </Grid>

            </TabItem>
        
        </TabControl>
        
    </StackPanel>
    
</Window>
